//
//  HttpPathParser.m
//  HttpServer
//
//  Created by xin.xu on 2017/8/24.
//  Copyright © 2017年 xin.xu. All rights reserved.
//

#import "HttpPathParser.h"
#import "HttpCreateHtml.h"


@implementation HttpPathParser
+ (NSData *)httpParserPath:(NSString *)url
{
    NSData *data = nil;
    if ([url isEqualToString:@"/"])
    {
        data = [[HttpCreateHtml albumHtmlFile] dataUsingEncoding:NSUTF8StringEncoding];
    }else if ([url isEqualToString:@"/JQuery/jquery-3.2.1.js"])
    {
        NSString *path =[[NSBundle mainBundle] pathForResource:@"Alumb_js" ofType:@"js"];
        data = [[NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil] dataUsingEncoding:NSUTF8StringEncoding];
    }else if ([url isEqualToString:@"/images/20170715125349.png"])
    {
        NSString *path =[[NSBundle mainBundle] pathForResource:@"Alumb_top" ofType:@"png"];
        data = [NSData dataWithContentsOfFile:path];
    }else if ([url isEqualToString:@"/css/style.css"])
    {
        NSString *path =[[NSBundle mainBundle] pathForResource:@"Alumb_css" ofType:@"css"];
        data = [[NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:nil] dataUsingEncoding:NSUTF8StringEncoding];
    }
    return data;
}
@end
